#include <Precision.h>
#include <cmath>
#include <limits>


using namespace std;

Precision::Precision(int precision,PrecisionAlgorithm algorithm) :
    precision_m(precision),algorithm_m(algorithm)
{
}

Precision::Precision(const Precision& precision) :
    precision_m(precision.precision_m), algorithm_m(precision.algorithm_m)
{
}

Precision&
Precision::operator=(const Precision& precision)
{
    precision_m = precision.precision_m;
    algorithm_m = precision.algorithm_m;
    return *this;
}

double Precision::operator()(double input) const
{
    return algorithm_m((input+std::numeric_limits<float>::epsilon()) * pow(10, precision_m)) / pow(10, precision_m);
}



